@extends('master')
@section('content')
<div class="container">
   <div id="alert-area">

   </div>
    <div id="user-edit" class="user-edit">
        <h4>修改资料</h4>
        <hr>
        @if(Session::get('errors'))
       <div class="alert alert-danger">
           {{ $errors->first() }}
       </div>
       @endif
       @if(Session::get('message'))
       <div class="alert alert-success">
           {{ Session::get('message') }}
       </div>
       @endif
        <form action="/user/edit" role="form" class="form-horizontal" method="post">
           <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-3 control-label">用户名： </label>
                    <div class="col-sm-6">
                        <p class="form-control-static">{{$userInfo->username}}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">邮箱：</label>
                    <div class="col-sm-6">
                        <input type="text" name="email" class="form-control" value="{{ $userInfo->email }}">
                    </div>

                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">密码：</label>
                    <div class="col-sm-6">
                        <input type="password" name="password" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">确认密码：</label>
                    <div class="col-sm-6">
                        <input type="password" name="password_confirmation" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">姓：</label>
                    <div class="col-sm-6">
                        <input type="text" name="firstname" class="form-control" value="{{ $userInfo->firstname }}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label">名字：</label>
                    <div class="col-sm-6">
                        <input type="text" name="lastname" class="form-control" value="{{ $userInfo->lastname }}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label">性别：</label>
                    <div class="col-sm-6">
                        <select class="form-control" name="sex">
                          <option value="0">请选择</option>
                          <option value="1" {{ $userInfo->sex == 1?'selected':'' }}>男</option>
                          <option value="2" {{ $userInfo->sex == 2?'selected':'' }}>女</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label">生日：</label>
                    <div class="col-sm-6">
                        <input type="text" name="birthday" class="form-control" value="{{ $userInfo->birthday }}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label">自我描述：</label>
                    <div class="col-sm-9">
                      <textarea name="description_me" cols="30" rows="5" class="form-control">{{ $userInfo->description_me }}</textarea>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="avatar-edit">
                   @if($userInfo->avatar)
                       <img src="{{ '/uploads/avatar/'. $userInfo->avatar }}" alt="" width="80" height="80" />
                   @else
                       <i class="glyphicon glyphicon-camera"></i>
                   @endif

                    <input id="avatar-file" type="file" name="avatar" />
                </div>
            </div>

            <span class="clearfix"></span>
            <div class="actions-btn row text-center">
                <button type="submit" class="btn btn-default">保存</button>
            </div>

        </form>
    </div>

</div>
@stop
